home *** CD-ROM | disk | FTP | other *** search
/ Freelog 115 / FreelogNo115-MaiJuin2013.iso / Internet / Filezilla Server / FileZilla_Server-0_9_41.exe / source / interface / misc / SAPrefsSubDlg.cpp < prev    next >
C/C++ Source or Header  |  2011-11-06  |  3KB  |  110 lines

  1. /*********************************************************************
  2.  
  3.    SAPrefsSubDlg
  4.  
  5.    Copyright (C) 2000 Smaller Animals Software, Inc.
  6.  
  7.    This software is provided 'as-is', without any express or implied
  8.    warranty.  In no event will the authors be held liable for any damages
  9.    arising from the use of this software.
  10.  
  11.    Permission is granted to anyone to use this software for any purpose,
  12.    including commercial applications, and to alter it and redistribute it
  13.    freely, subject to the following restrictions:
  14.  
  15.    1. The origin of this software must not be misrepresented; you must not
  16.      claim that you wrote the original software. If you use this software
  17.      in a product, an acknowledgment in the product documentation would be
  18.      appreciated but is not required.
  19.  
  20.    2. Altered source versions must be plainly marked as such, and must not be
  21.      misrepresented as being the original software.
  22.  
  23.    3. This notice may not be removed or altered from any source distribution.
  24.  
  25.    http://www.smalleranimals.com
  26.    smallest@smalleranimals.com
  27.  
  28. **********************************************************************/
  29.  
  30. // SAPrefsSubDlg.cpp: implementation of the CSAPrefsSubDlg class.
  31. //
  32. //////////////////////////////////////////////////////////////////////
  33.  
  34. #include "stdafx.h"
  35. #include "SAPrefsSubDlg.h"
  36.  
  37. #if defined(_DEBUG) && !defined(MMGR)
  38. #undef THIS_FILE
  39. static char THIS_FILE[]=__FILE__;
  40. #define new DEBUG_NEW
  41. #endif
  42.  
  43. //////////////////////////////////////////////////////////////////////
  44. // Construction/Destruction
  45. //////////////////////////////////////////////////////////////////////
  46. IMPLEMENT_DYNCREATE(CSAPrefsSubDlg, CDialog)
  47.  
  48. CSAPrefsSubDlg::CSAPrefsSubDlg()
  49. {
  50.    ASSERT(0);
  51.    // don't use this constructor!
  52. }
  53.  
  54. CSAPrefsSubDlg::CSAPrefsSubDlg(UINT nID, CWnd *pParent /*=NULL*/)
  55. : CDialog(nID)
  56. {
  57.    m_id = nID;
  58. }
  59.  
  60. CSAPrefsSubDlg::~CSAPrefsSubDlg()
  61. {
  62. }
  63.  
  64. BEGIN_MESSAGE_MAP(CSAPrefsSubDlg, CDialog)
  65.     //{{AFX_MSG_MAP(CHTMLAppearance)
  66.     //}}AFX_MSG_MAP
  67. END_MESSAGE_MAP()
  68.  
  69. void CSAPrefsSubDlg::OnOK()
  70. {
  71.    EndDialog(IDOK);
  72. }
  73.  
  74. void CSAPrefsSubDlg::OnCancel()
  75. {
  76.    EndDialog(IDCANCEL);
  77. }
  78.  
  79. BOOL CSAPrefsSubDlg::PreTranslateMessage(MSG* pMsg) 
  80. {
  81.     // Don't let CDialog process the Escape key.
  82.     if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_ESCAPE))
  83.     {
  84.     //    return TRUE;
  85.     }
  86.     
  87.     // Don't let CDialog process the Return key, if a multi-line edit has focus
  88.     if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
  89.     {
  90.         // Special case: if control with focus is an edit control with
  91.         // ES_WANTRETURN style, let it handle the Return key.
  92.  
  93.         TCHAR szClass[10];
  94.         CWnd* pWndFocus = GetFocus();
  95.         if (((pWndFocus = GetFocus()) != NULL) &&
  96.             IsChild(pWndFocus) &&
  97.             (pWndFocus->GetStyle() & ES_WANTRETURN) &&
  98.             GetClassName(pWndFocus->m_hWnd, szClass, 10) &&
  99.             (lstrcmpi(szClass, _T("EDIT")) == 0))
  100.         {
  101.             pWndFocus->SendMessage(WM_CHAR, pMsg->wParam, pMsg->lParam);
  102.             return TRUE;
  103.         }
  104.  
  105.         return FALSE;
  106.     }
  107.  
  108.     return CDialog::PreTranslateMessage(pMsg);
  109. }
  110.